using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace CubicFWNet.Data.Models.Mapping
{
    public class LogInLogMap : EntityTypeConfiguration<LogInLog>
    {
        public LogInLogMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.UserName)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.RealName)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Type)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.IPAddress)
                .HasMaxLength(50);

            this.Property(t => t.IPAddressName)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("LogInLog");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Time).HasColumnName("Time");
            this.Property(t => t.UserId).HasColumnName("UserId");
            this.Property(t => t.UserName).HasColumnName("UserName");
            this.Property(t => t.RealName).HasColumnName("RealName");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.IPAddress).HasColumnName("IPAddress");
            this.Property(t => t.IPAddressName).HasColumnName("IPAddressName");
        }
    }
}
